home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
arexx
/
zedrexx.lha
/
ZedREXX
/
REXX
/
Events.zrx
< prev
next >
Wrap
Text File
|
1994-08-08
|
3KB
|
128 lines
/* $VER: events.zrx 1.0 (1.08.94)
* A little script that shows some of the events
* Copyright (c) 1993-1994 Reality Check, Inc.
*
*/
OPTIONS RESULTS
SIGNAL ON ERROR
SIGNAL ON HALT
/* Application Data */
'zInterface zEvents'
'zWindow Main Label "Event Example" Open Centered CloseEvent DropEvent ChildMaxWidth'
'zMenu Project'
'zObject Button Quit Label "&Quit" SelectEvent'
'zEndMenu'
'zObject TextDisplay TL0 NumColumns=20 NoBorder Value="Drop Directories on ME!" Justification=Center'
'zObject TextDisplay DName NumColumns=20'
'zObject ListView DDir NumColumns=20 NumLines=5 Order=Ascend ChangeEvent'
'zObject ListView DFile NumColumns=20 NumLines=10 Order=Ascend ReadOnly'
'zObject Line'
'zGroup Horizontal ChildMaxWidth'
'zObject Button OK Label "&OK" SelectEvent'
'zObject Button Cancel Label "&Cancel" SelectEvent'
'zEndGroup'
'zEndWindow'
'zWindow Events Label "Events" Open Centered DropEvent NoClose'
'zObject TextDisplay TDO NumColumns=15 Label="RESULT:"'
'zObject TextDisplay Window NumColumns=15 Label="Window:"'
'zObject TextDisplay Object NumColumns=15 Label="Object:"'
'zObject TextDisplay Event NumColumns=15 Label="Event:"'
'zObject TextDisplay Qualifiers NumColumns=15 Label="Qualifiers:"'
'zObject IntegerDisplay MouseX NumColumns=6 Label="Mouse X:"'
'zObject IntegerDisplay MouseY NumColumns=6 Label="Mouse Y:"'
'zObject TextDisplay Value NumColumns=15 Label="Value:"'
'zObject TextDisplay ValueIndex NumColumns=15 Label="Value Index:"'
'zEndWindow'
'zEndInterface'
/* Turn everything on */
'zDoMethod zEvents Activate'
/* Enter the event loop */
DO FOREVER
/* Wait for something to happen */
'zWaitForEvent stem.'
intrp = RESULT
/* Update the fields in the Events window */
'zSetAttr TD0 Value='RESULT
'zSetAttr Events Fields stem.'
/* Do something with the event */
INTERPRET "zRC="intrp"()"
END
Halt:
Quit_Select:
zEvents_Quit:
EXIT
Error:
IF RC=20 THEN DO
SAY "Must be run within zrx"
EXIT
END
SAY "Error" RC "at line" SIGL " (errnum="zErrNum")"
EXIT
Main_Close:
EXIT
OK_Select:
Cancel_Select:
Events_Drop:
Return 0
Main_Drop:
/* Get the name of the first object dropped */
Parse var stem.value first '|' last
/* Show it */
ShowDirectory(first)
Return 0
DDir_Change:
/* Make sure it changed from a user interaction, not
* from a program action */
IF stem.qualifiers="" THEN DO
'zGetAttr DName Value'
first=RESULT
IF (stem.value="..") THEN name=ParentDir(first)
ELSE name=AddPart(first,stem.value)
ShowDirectory(name)
END
Return 0
ShowDirectory: PROCEDURE
PARSE ARG first
/* Lock the display so that nothing can happen */
'zDoMethod zEvents Lock'
/* Set the volume name object */
'zSetAttr DName Value' first
/* Clear the list views */
'zSetAttr DDir Items=""'
'zSetAttr DFile Items=""'
/* Get the directory */
CALL ExAll(first,entries.)
IF Info(first,stem.) = 1 THEN DO
IF ~(stem.name||":"=first) THEN 'zDoMethod DDir Add ".."'
END
/* Add the directory parts to the correct listview */
DO i=0 TO (entries.count - 1)
IF entries.i.direntrytype="DIRECTORY" THEN 'zDoMethod DDir Add' entries.i.filename
ELSE 'zDoMethod DFile Add' entries.i.filename
END
/* Unlock the display */
'zDoMethod zEvents UnLock'
Return 0